home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-01-14 | 1.9 KB | 62 lines | [TEXT/MPS ] |
- /* _________________________________________________________________________________________________________ //
- Copyright © 1992 Apple Computer, Inc. All rights reserved.
- Macintosh Developer Technical Support.C++ Macintosh Toolbox Framework.
- Originator: Kent Sandvik
- Date: Friday, July 10, 1992 10:14:13
- Revision comments are at the end of this file.
- ---
- TTracer is an example of a stack/heap based tracing class, which could be
- used for tracing memory leaks and keeping track of created objects
- TTracer.cp contains the class body information for the initial class construction.
- _________________________________________________________________________________________________________ */
-
-
- // Include files
- #ifndef _TRACER_
- #include "Tracer.h"
- #endif
-
-
- // _________________________________________________________________________________________________________ //
- // TTracer class member function implementations
-
- // CONSTRUCTORS & DESTRUCTORS
- #pragma segment Tracer
- TTracer::TTracer(const char* label,
- const char* file,
- int line) :
- fLabel(label),
- fFile(file),
- fLine(line)
- // Default constructor.
- {
- fReferenceCount++;
-
- cout << "File " << fFile << " ; Line " << fLine << " #+++ constructor event in " << fLabel << " (reference count = " << fReferenceCount << ")\n";
- }
-
-
- #pragma segment Tracer
- TTracer::~TTracer()
- // Default destructor.
- {
- fReferenceCount--;
- cout << "File " << fFile << " ; Line " << fLine << " #--- destructor event in " << fLabel << " (reference count = " << fReferenceCount << ")\n";
- }
-
-
- // GLOBAL FUNCTIONS
- int TTracer::fReferenceCount = 0; // initialize with zero value
-
- // this will construct a global/universal tracer
- TTracer gGlobalTracer("gGlobalTracer",
- TRACEPOINT);
-
-
- // _________________________________________________________________________________________________________ //
-
- /* Change History (most recent last):
- No Init. Date Comment
- 1 khs 7/10/92 New file
- */
-